package behavior.mediator.impl;

import behavior.mediator.Mediator;
import behavior.mediator.Person;

/**
 * 房屋总结
 * 
 * @author thinkpad
 *
 */
public class HouseMediator implements Mediator {

	// 首先中介结构必须知道所有房主和租房者的信息
	private HouseOwner houseOwner;
	private Tenant tenant;

	public HouseOwner getHouseOwner() {
		return houseOwner;
	}

	public void setHouseOwner(HouseOwner houseOwner) {
		this.houseOwner = houseOwner;
	}

	public Tenant getTenant() {
		return tenant;
	}

	public void setTenant(Tenant tenant) {
		this.tenant = tenant;
	}

	public String constact(String message, Person person) {
		if (person == houseOwner) { // 如果是房主，则租房者获得信息
			return "中介通知租客-->" + tenant.getMessage(message);
		} else { // 反正则是房主获得信息
			return "中介通知房主-->" + houseOwner.getMessage(message);
		}
	}

}
